package com.bwie.controller;

import com.bwie.pojo.TbDraw;
import com.bwie.service.TbDrawService;
import com.bwie.utils.R;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/draw/index")
public class IndexController {

    @Autowired
    TbDrawService drawService;

    @PostMapping("/getDrawList")
    public R getDrawList(){

        return drawService.getDrawList();
    }

    @ApiOperation("活动的添加")
    @PostMapping("/Adddraw")
    public R Adddraw(@RequestBody TbDraw tbDraw){
        return drawService.Adddraw(tbDraw);
    }

    @ApiOperation("活动的删除")
    @PostMapping("/DeleteDraw/{drawId}")
    public R DeleteDraw(@PathVariable(value = "drawId")Integer drawId){
        return drawService.deleteDraw(drawId);
    }

    @ApiOperation("修改")
    @PostMapping("/updateDraw")
    public R updateDraw(@RequestBody TbDraw tbDraw){
        return drawService.updateDraw(tbDraw);
    }
}
